package io.kiki.sba.registry.server.data_store.remoting;

import io.kiki.sba.registry.api.ChannelHandler;
import io.kiki.sba.registry.api.exchange.DataExchanger;
import io.kiki.sba.registry.server.data_store.bootstrap.ServerConfig;
import io.kiki.sba.registry.server.shared.remoting.ClientSideExchanger;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Collection;
import java.util.Collections;


public class SessionNodeExchanger extends ClientSideExchanger {
    @Autowired
    private ServerConfig serverConfig;

    public SessionNodeExchanger() {
        super(DataExchanger.SESSION_SERVER_TYPE);
    }

    @Override
    public int getRpcTimeoutMillis() {
        return serverConfig.getRpcTimeoutMillis();
    }

    @Override
    public int getServerPort() {
        // the Exchanger only for sync session
        return serverConfig.getSyncSessionPort();
    }

    @Override
    public int getConnNum() {
        return serverConfig.getSyncSessionConnNum();
    }

    @Override
    protected Collection<ChannelHandler> getClientHandlers() {
        return Collections.emptyList();
    }


}
